package cn.edu.scau.cmi.zhuangyi.client;

import org.springframework.context.ApplicationContext;

import cn.edu.scau.cmi.zhuangyi.spring.domain.Student;
import cn.edu.scau.cmi.zhuangyi.spring.domain.Teacher;
import cn.edu.scau.cmi.zhuangyi.spring.util.ApplicationContextUtil;

public class SpringSingletonApplicationContextClient {
	private static Teacher liangzaoqing;
	private static Student zhangsan;

	

	public static void main(String[] args) {
		getApplicationContext();
		System.out.println(zhangsan.getName()+" Teacher is "+zhangsan.getTutor().getName());
	}


	private static ApplicationContext getApplicationContext() {
		ApplicationContext applicationContext=ApplicationContextUtil.getApplicationContext();
		zhangsan=(Student) applicationContext.getBean("zhangsan");
		return applicationContext;
	}

}
